package org.snacktest.annotation.use;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.snackframework.annotation.Autowired;
import org.snackframework.annotation.Controller;
import org.snackframework.annotation.UrlMapping;
import org.springframework.jdbc.core.JdbcTemplate;

/**
 * 
 * @author allen Jun 19, 2010
 *
 */
@Controller("localController")
public class FormAction
{
	@Autowired
	private JdbcTemplate jdbcTemplate;
	
	@UrlMapping("/hello/welcomehandle.htm")
	public void handle(HttpServletRequest req,HttpServletResponse resp)
	{
		jdbcTemplate.execute("select * from userr");
		
		String fname=req.getParameter("fname");
		String lname=req.getParameter("lname");
		String pwd=req.getParameter("pwd");
		try
		{
			resp.getWriter().println("Full Name: "+fname+" "+lname+"<br />"+"Password: "+pwd+"<br />");
		
		}
		catch(IOException e)
		{
			e.printStackTrace();
		}
	}
}
